package com.irs.irsforum.exception;

import org.apache.log4j.Level;
/**
 * @author Liyihui
 * @Date: 2020/3/22
 * @Time: 3:08
 */
public interface IIrsForumException {

    public ExceptionType getExceptionType();

     static enum IrsForumExceptionType implements ExceptionType {

         NOT_AUTHORIZED(2001),
         USER_NOT_LOGIN {
             @Override
             public int getErrorCode() {return 2002;}
             @Override
             public Level getLogLevel(){return Level.DEBUG;}
         },
         ILLEGAL_LOGIN(2003)
         ;

         IrsForumExceptionType() {
             this(1000, Level.WARN);
         }

         IrsForumExceptionType(int code) {
             this(code, Level.WARN);
         }

         IrsForumExceptionType(int code, Level level) {
             this.code = code;
             this.level = level;
         }
         final int code;
         final Level level;


         @Override
         public int getErrorCode() {
             return this.code;
         }

         public Level getLogLevel() {
             return this.level;
         }

         @Override
         public String getName() {
             return name();
         }


     }
}
